package xyz.jiang.asteroid.common.exception;

import xyz.jiang.asteroid.common.enums.ServiceExceptionEnum;

public class ServiceException extends RuntimeException{
    private Integer code;
    private String msg;

    public ServiceException(Integer code,String msg){
        this.code = code;
        this.msg = msg;
    }
    public ServiceException(String msg){
        this.code = 400;
        this.msg = msg;
    }
    public ServiceException(ServiceExceptionEnum exceptionEnum) {
        this(exceptionEnum.getCode(), exceptionEnum.getMsg());
    }

    public Integer getCode() {
        return code;
    }

    public String getMessage() {
        return msg;
    }


}